CSharpTest.Net
GetHashCode(Byte[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > BinaryComparer Class > GetHashCode Method : GetHashCode(Byte[]) Method

bytes

Glossary Item Box

Returns a hash code the instance of the object

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function GetHashCode( _
   ByVal bytes() As Byte _
) As Integer
C# 
public static int GetHashCode( 
   byte[] bytes
)

Parameters

bytes

Example

Library/Library.Test/TestBinaryComparer.cs

C#Copy Code
Assert.AreEqual(0, BinaryComparer.GetHashCode(null));
Assert.AreEqual(0, BinaryComparer.GetHashCode(new byte[] { }));
Assert.AreEqual(BinaryComparer.GetHashCode(new byte[] { 1, 2, 3 }), BinaryComparer.GetHashCode(new byte[] { 1, 2, 3 }));

Assert.AreNotEqual(BinaryComparer.GetHashCode(null), BinaryComparer.GetHashCode(new byte[] { 1, 2, 3 }));
Assert.AreNotEqual(BinaryComparer.GetHashCode(new byte[] { 1, 2, 3 }), BinaryComparer.GetHashCode(null));
Assert.AreNotEqual(BinaryComparer.GetHashCode(new byte[] { 1, 2 }), BinaryComparer.GetHashCode(new byte[] { 1, 2, 3 }));
Assert.AreNotEqual(BinaryComparer.GetHashCode(new byte[] { 1, 2, 3 }), BinaryComparer.GetHashCode(new byte[] { 1, 2 }));
VB.NETCopy Code
Assert.AreEqual(0, BinaryComparer.GetHashCode(Nothing))
Assert.AreEqual(0, BinaryComparer.GetHashCode(New Byte() {}))
Assert.AreEqual(BinaryComparer.GetHashCode(New Byte() {1, 2, 3}), BinaryComparer.GetHashCode(New Byte() {1, 2, 3}))

Assert.AreNotEqual(BinaryComparer.GetHashCode(Nothing), BinaryComparer.GetHashCode(New Byte() {1, 2, 3}))
Assert.AreNotEqual(BinaryComparer.GetHashCode(New Byte() {1, 2, 3}), BinaryComparer.GetHashCode(Nothing))
Assert.AreNotEqual(BinaryComparer.GetHashCode(New Byte() {1, 2}), BinaryComparer.GetHashCode(New Byte() {1, 2, 3}))
Assert.AreNotEqual(BinaryComparer.GetHashCode(New Byte() {1, 2, 3}), BinaryComparer.GetHashCode(New Byte() {1, 2}))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys